<?php
namespace Tbf\Bundle\TaskManageBundle;
use Symfony\Component\DependencyInjection\ContainerAware;
use Tbf\Component\CallNum\CallNumFunction;

class MockTask extends ContainerAware implements TaskInterface{
    protected $call_num_id = null;
    protected $callback;
    public function __construct(){
        $this->call_num_id = CallNumFunction::newId();
    }
    public function run()
    {
        $ret = CallNumFunction::addOne($this->call_num_id);
        $callback = $this->callback;
        if (is_callable($callback)){
            return $callback($this->container);
        }
        return null;
    }
    public function setCallback($callback){
        $this->callback = $callback;
    }
    public function getCallNum(){
        return CallNumFunction::get($this->call_num_id);
    }
}